﻿using UnityEngine;

public class RoundDisplay : MonoBehaviour
{
    public float speed = 10.0f;
    public float distance = 5f;
    public float height = 1f;
    public Transform look;
    public Vector3 lookOffset;

    private Vector3 radiusDir;

    private void Start()
    {
        radiusDir = new Vector3(distance, 0, 0);
    }

    private void Update()
    {
        radiusDir.y = height;
        Rotate(ref radiusDir, Time.deltaTime * speed);

        transform.position = look.position + radiusDir;
        transform.LookAt(look.position + lookOffset);
    }

    private void Rotate(ref Vector3 source, float angle)
    {
        Quaternion q = Quaternion.AngleAxis(angle, Vector3.up);
        source = q * source;
    }
}